<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\Sku
 *
 * @property int $id
 * @property string|null $name 名称
 * @property string|null $desc 描述
 * @property int $sort 排序
 * @property int $status 状态 0：关闭 1：开启
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static bool|null forceDelete()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Sku newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Sku newQuery()
 * @method static \Illuminate\Database\Query\Builder|\App\Sku onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Sku query()
 * @method static bool|null restore()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Sku whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Sku whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Sku whereDesc($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Sku whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Sku whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Sku whereSort($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Sku whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Sku whereUpdatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Sku withTrashed()
 * @method static \Illuminate\Database\Query\Builder|\App\Sku withoutTrashed()
 * @mixin \Eloquent
 */
class Sku extends Model
{
    protected $table = "sku";
    use SoftDeletes;

    public static function getSkuName($id){
        $sku = self::whereId($id)->first();
        return $sku ? $sku->name : '';
    }
}
